import type { EducationVO, EducationForm, EducationQuery } from './model';

import type { ID, IDS } from '#/api/common';
import type { PageResult } from '#/api/common';

import { commonExport } from '#/api/helper';
import { requestClient } from '#/api/request';

export function educationTitleList(params?: EducationQuery) {
  return requestClient.get<PageResult<EducationVO>>(
    '/business/education/idTitleList',
    { params },
  );
}
/**
 * 查询宣教知识列表
 * @param params
 * @returns 宣教知识列表
 */
export function educationList(params?: EducationQuery) {
  return requestClient.get<PageResult<EducationVO>>(
    '/business/education/list',
    { params },
  );
}

/**
 * 导出宣教知识列表
 * @param params
 * @returns 宣教知识列表
 */
export function educationExport(params?: EducationQuery) {
  return commonExport('/business/education/export', params ?? {});
}

/**
 * 查询宣教知识详情
 * @param id id
 * @returns 宣教知识详情
 */
export function educationInfo(id: ID) {
  return requestClient.get<EducationVO>(`/business/education/${id}`);
}

/**
 * 新增宣教知识
 * @param data
 * @returns void
 */
export function educationAdd(data: EducationForm) {
  return requestClient.postWithMsg<void>('/business/education', data);
}

/**
 * 更新宣教知识
 * @param data
 * @returns void
 */
export function educationUpdate(data: EducationForm) {
  return requestClient.putWithMsg<void>('/business/education', data);
}

/**
 * 删除宣教知识
 * @param id id
 * @returns void
 */
export function educationRemove(id: ID | IDS) {
  return requestClient.deleteWithMsg<void>(`/business/education/${id}`);
}
